class UnitInput < SimpleForm::Inputs::Base
  def input(wrapper_options)

    template.content_tag(:div, class: 'input-group date unit') do
      template.concat @builder.text_field(attribute_name, input_html_options.merge(type: 'number'))
      template.concat span_unit(options[:unit])
    end
  end

  def input_html_options
      super.merge({class: 'form-control'})
    end

  def span_unit unit
    template.content_tag(:span, class: 'input-group-addon') do
      unit.html_safe
    end
  end
end
